<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@ include file="../baselayout/import.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="${staticPath}/assets/css/bootstrap.min.css">
<link rel="stylesheet" href="${staticPath}/assets/css/sparkol.css">
<title>自然文本转化界面</title>
<style>
html,body{
	width:100%;
	height:100%;
}

form{
	text-align:center;
	height:100%;
	position:relative;
	width:100%;
}
#text{
	display:block;
	width:100%;
	height:400px;
	text-shadow:2px 2px rgba(128,128,128,0.3);
	box-shadow:10px 10px 20px rgba(128,128,128,0.5);
		-moz-box-shadow:10px 10px 20px rgba(128,128,128,0.5);
	-webkit-box-shadow:10px 10px 20px rgba(128,128,128,0.5);
	-ms-box-shadow:10px 10px 20px rgba(128,128,128,0.5);
	font-size:1.5em;
}
input[type=submit]{
	width:100px;
	margin:30px auto;
	text-shadow:2px 2px rgba(128,128,128,0.3);
	box-shadow:10px 10px 20px rgba(128,128,128,0.5);
	-moz-box-shadow:10px 10px 20px rgba(128,128,128,0.5);
	-webkit-box-shadow:10px 10px 20px rgba(128,128,128,0.5);
	-ms-box-shadow:10px 10px 20px rgba(128,128,128,0.5);
}
.header{
	position:relative;
}
.header > a{
	position:absolute;
	right:20px;
	top:0;
}
.header .tip a{
	margin:10px 10px;
}
</style>
</head>
<body>
<div class="panel panel-primary">
	<div class="panel-body">
		<c:choose>
		       <c:when test="${isExist}">
		           	<div class="header ">
						<h1 >输入待转换成文本向量的自然文本</h1>
						<div class="tip">
	  						<a class="btn btn-success" href="${staticPath}/fp/download.do?filename=feature.txt">下载feature</a>
	  						<a class="btn btn-success" href="${staticPath}/fp/download.do?filename=label.txt">下载label</a>
	  						<a class="btn btn-success" href="${staticPath}/fp/download.do?filename=vectors.txt">下载vectors</a>
						</div>
					</div>
					
					<form action="${staticPath}/fp/trans.do" method="post" target="_blank">
						<textarea id="text" name = "text" ></textarea>
						<input class="button button-primary" type="submit" value="提交">
			
					</form>
					
					<div class="panel panel-primary">
					      <div class="panel-heading">
					        <h3 class="panel-title">文件批量转换</h3>
					      </div>
					      <div class="panel-body">
					        <form id="upload" target="_blank" method="post" action="./trans.do" enctype="multipart/form-data" target="_blank">
					        	<button class="btn btn-primary" type="button" onclick="upload(this)" >选择文件文本文件</button>
					        	<div>
					        		<label id="fn"></label>
					        		<input id="file" style="display:none" type="file" name="file" onchange="change(this)">
					        	</div>
					        	<input type="submit"  class="btn btn-info" value="提交">        
					        </form>
					      </div>
					</div>
	
		       </c:when>
		       <c:otherwise>
		     			<div class="header">
						<h1>模型不存在,请训练之</h1>
						<h2>${message }</h2>
					</div>
			
					<form action="${staticPath}/fp/train.do" method="post" target="_blank">
						<input type="hidden" name = "flag" value="something">
						<input class="button button-primary" type="submit" value="训练模型">
					</form>
		       </c:otherwise>
		</c:choose>
	</div>
 </div>
 

    <script src="${staticPath}/js/jQuery-1.9.1.js"></script>
    <script>
    	function change(btn){
    		var file = $(btn).val();
    		if(typeof file == 'string' && file.length>0){
    			//$("#upload input[type=submit]").click();
    			$("#fn").html(file);
    		}
    	}
    	function upload(btn){
    		$("#file").click();
    	}
    	
    </script>

 
 
 
</body>

</html>